﻿using UnityEngine;
using System.Collections;

public class GameObjectControler : MonoBehaviour 
{
    public bool UsePlayerPresets = false;

    public float TranslationSpeed = .1f;
    public float RotationSpeed = 1f;

    public KeyCode KeyForward = KeyCode.W;
    public KeyCode KeyBackward = KeyCode.S;
    public KeyCode KeyRight = KeyCode.D;
    public KeyCode KeyLeft = KeyCode.A;

    public KeyCode KeyRotateForward = KeyCode.DownArrow;
    public KeyCode KeyRotateBackward = KeyCode.UpArrow;
    public KeyCode KeyRotateRight = KeyCode.RightArrow;
    public KeyCode KeyRotateLeft = KeyCode.LeftArrow;

	// Use this for initialization
	void Start () 
    {
	
	}
	
	// Update is called once per frame
	void Update () 
    {
        
        if (UsePlayerPresets)
        {

        }
        else
        {
            // Translation
            if (Input.GetKey(KeyForward))
                transform.Translate(Vector3.forward * TranslationSpeed);

            if (Input.GetKey(KeyBackward))
                transform.Translate(Vector3.back * TranslationSpeed);

            if (Input.GetKey(KeyLeft))
                transform.Translate(Vector3.left * TranslationSpeed);

            if (Input.GetKey(KeyRight))
                transform.Translate(Vector3.right * TranslationSpeed);
                
            // Rotation
            if (Input.GetKey(KeyRotateForward))
                transform.Rotate(Vector3.right, RotationSpeed);

            if (Input.GetKey(KeyRotateBackward))
                transform.Rotate(Vector3.left, RotationSpeed);

            if (Input.GetKey(KeyRotateLeft))
                transform.Rotate(Vector3.down, RotationSpeed);

            if (Input.GetKey(KeyRotateRight))
                transform.Rotate(Vector3.up, RotationSpeed);
        }
	}


}
